
{extend name='table'}



{block name="content"}
<div class="layui-card padding-20 shadow layui-card-body" >
    {include file='notice/index_search'}
    <table id="NoticeTable" data-url="{:sysuri()}" data-target-search="form.form-search"></table>
</div>
{/block}
{block name='script'}
<script>
    $(function () {
        let auth = '{:auth("edit")}'
        let cols = [];
        if(auth=='1'){
            cols = [[
                {checkbox: true, fixed: true},
                {field: 'sort', title: '{:lang("排序权重")}', width: 100, align: 'center', templet: '#SortInputTpl'},
                {title: '序号', type: 'numbers', width: 100},
                {field: 'title', title: '标题', align: "center", minWidth: 120},
                {field: 'introduction', title: '概述', align: "center", minWidth: 500},
                {field: 'create_at', title: '发布时间', align: 'center', minWidth: 120,},
                {toolbar: '#toolbar', title: '操作面板', align: 'center', minWidth: 150, fixed: 'right'},
            ]];
        }else{
            cols = [[
                {checkbox: true, fixed: true},
                {field: 'title', title: '标题', align: "center", minWidth: 120},
                {field: 'introduction', title: '概述', align: "center", minWidth: 500},
                {field: 'create_at', title: '发布时间', align: 'center', minWidth: 120,},
                {toolbar: '#toolbar', title: '操作面板', align: 'center', minWidth: 150, fixed: 'right'},
            ]];
        }
        // 初始化表格组件
        $('#NoticeTable').layTable({
            even: true, height: 'full',
           // sort: {field: 'uuid desc', type: 'desc'},
            cols: cols

        });


    });

</script>

<!-- 列表排序权重模板 -->
<script type="text/html" id="SortInputTpl">
    <input type="number" min="0" data-blur-number="0" data-action-blur="{:sysuri()}" data-value="id#{{d.id}};action#sort;sort#{value}" data-loading="false" value="{{d.sort}}" class="layui-input text-center">
</script>

<!-- 数据操作工具条模板 -->
<script type="text/html" id="toolbar">
    <a class="layui-btn  layui-btn-sm"  data-full="true" data-event-dbclick data-title="公告详情" data-modal='{:url("info")}?id={{d.id}}'>查 看</a>
    <!--{if auth("edit") }-->
    <a class="layui-btn layui-btn-primary layui-btn-sm"  data-full="true" data-modal='{:url("edit")}?id={{d.id}}'>编 辑</a>
    <!--{/if}-->

    <!--{if auth("remove") }-->
    <a class="layui-btn layui-btn-danger layui-btn-sm" data-action="{:url('remove')}" data-value="id#{{d.id}}" data-confirm="确定要删除吗?">删 除</a>
    <!--{/if}-->
</script>
{/block}